import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

/// 屏幕适配器
class ScreenUtils {
  /// 获取屏幕宽度
  static double getScreeenWidth(BuildContext context) {
    return MediaQuery.of(context).size.width;
  }

  /// 获取屏幕高度
  static double getScreeenHeidth(BuildContext context) {
    return MediaQuery.of(context).size.height;
  }

  /// 获取状态栏高度
  static double getStateHeight() {
    return MediaQueryData.fromWindow(window).padding.top;
  }

  ///px转换为dp
  static double height(double pxValue) {
    return ScreenUtil().setHeight(pxValue);
  }

  ///px转换为dp
  static double width(double pxValue) {
    return ScreenUtil().setWidth(pxValue);
  }

  ///px转换为sp
  static double sp(double pxValue) {
    return ScreenUtil().setSp(pxValue);
  }
}
